﻿@model IEnumerable<ETA.Entity.ReferrerLog>
@{
    ViewBag.Title = "快车之友";
    int? pointTotal = 0;//获得积分总计 即推荐一人就有1000积分与是否出国无关
    int? unUsedPointTotal = 0;//已出国的实习生有关的数据 总分减去已兑换
    int? usedPointTotal = 0;//已兑换
}

<div class="mainContentWithBorderNopadding2">
    <input type="hidden" id="hiddenIsReferrer" data-IsReferrer="@ViewBag.IsReferrer"/>
    <div class="ExpandDes">
        @*轮询banner*@
        <div data-ride="carousel" class="carousel slide" id="divExpandBanner">
            <div class="carousel-inner">
                <div class="item active" style="height: 646px">
                    <div class="pull-left" style="margin-left: 30px">
                        <img src="~/Content/Image/Expand/expand1.png" style="height: 400px; width: 500px" />
                    </div>
                    <div class="pull-left" style="text-align: center; padding-top: 160px; padding-left: 50px">
                        <h2 style="font-weight: bold">(快车之友)欢迎您！</h2>
                        <p>欢迎各路人士参与宣传推广（出国快车）,引荐人才，</p>
                        <p>（快车之友人才推荐奖励制度）是我们对快车之友的</p>
                        <p>诚挚感谢</p>
                    </div>
                </div>
                <div class="item" style="height: 646px">
                    <div>
                        <img src="~/Content/Image/Expand/expand2.png" style="height: 646px; width: 100%" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    <br />
    <div class="divLog">
        <p><span class="spanBig">积分总数：</span><span id="usedPoint"></span><span class="chuiZhiLine"></span><span class="spanBig">可兑换积分总数：</span><span id="unUsedPoint"></span></p>
        <table class="table table-bordered table-hover ExpandTB">
            <thead>
                <tr>
                    <td>被推荐人ID</td>
                    <td>被推荐人姓名</td>
                    <td>注册时间</td>
                    <td>出国时间</td>
                    <td>获得积分</td>
                    <td>可兑换积分</td>
                </tr>
            </thead>
            <tbody>
                @foreach (var log in Model)
                {
                    var abroadDate = string.Empty;
                    var point = log.Point;
                    var usedPoint = log.UsedPoint;
                    int? unUsedPoint = 0;
                    var unUsedPointStr = string.Empty;
                    var registrationBind = log.Referrer.RegistrationBind;
                    if (registrationBind != null && registrationBind.IsDelete == false)
                    {
                        abroadDate = registrationBind.CreateDate.ToShortDateString();
                        unUsedPoint = point - (usedPoint.HasValue ? usedPoint : 0);
                        usedPointTotal += usedPoint;
                    }

                    unUsedPointStr = unUsedPoint == 0 ? "" : unUsedPoint.ToString();
                    pointTotal += point;
                    unUsedPointTotal += unUsedPoint;
                    <tr>
                        <td>@log.Referrer.UserId</td>
                        <td>@log.Referrer.UserName</td>
                        <td>@log.Referrer.CreateDate.ToShortDateString()</td>
                        <td>@abroadDate</td>
                        <td>@point</td>
                        <td>@unUsedPointStr</td>
                    </tr>
                }
            </tbody>
            <tfoot>
                <tr>
                    <td>合计</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>@pointTotal</td>
                    <td>@unUsedPointTotal</td>
                </tr>
            </tfoot>
        </table>
        <input type="hidden" id="hiddendusedPoint" value="@pointTotal"/>
        <input type="hidden" id="hiddendUnusedPoint" value="@unUsedPointTotal"/>
    </div>
    <div class="clear"></div>


    <script id="BeReferrer_template" type="text/x-handlebars-template">
        <div id="divBeReferrer">
            <h4>是否成为快车之友</h4>
            <br />
            <p style="text-align:center">
                <button type="button" class="btn btn-primary" id="btnBeReferrer">是</button>&nbsp;&nbsp;
            <button type="button" class="btn btn-default" id="btnCloseDialog">否</button>
            </p>
        </div>
    </script>


</div>

@section scripts
{
        @Scripts.Render("~/bundles/JSTmp")
    @Scripts.Render("~/bundles/Expand")
}
